package com.momo.res;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * Created by Kagome on 2019/5/15.
 */
@Data
public class WXresult {
    private String errcode;
    private String errmsg;

    public static JSONResult jsonResult(String wxResult){
        if (StringUtils.isEmpty(wxResult)){
            return JSONResult.errorMap("请求繁忙");
        }
        WXresult student = JSON.parseObject(wxResult, new TypeReference<WXresult>() {});
        return JSONResult.build(Integer.valueOf(student.getErrcode()),student.getErrmsg(),student.getErrmsg());
    }
}
